package cn.audit.repository.role;

import cn.audit.bean.pojo.RoleManager;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author: 李忆枫
 * @Date: 2019/5/19 17:11
 */
public interface RoleRepository extends JpaRepository<RoleManager, Long>, JpaSpecificationExecutor<RoleManager> {

    /**
     * 批量删除角色
     * @param ids
     */
    @Modifying(clearAutomatically = true)
    @Query(value = "DELETE FROM RoleManager r  WHERE r.id IN ?1")
    void BatchRemove(List<Long> ids);

}
